﻿package extremefx.tools {
	import flash.utils.ByteArray;		

	/**
	 * @author Marcelo Volmaro
	 */
	public final class ObjectUtils {
		public static function merge(pBase:Object, pExtend:Object, pProps:Vector.<String> = null):void {
	
			if (pProps){
				for each (var key1:String in pProps){
					pBase[key1] = pExtend[key1];
				}
				
			} else {
				for (var key:String in pExtend){
					pBase[key] = pExtend[key];
				}
			}
		}
		
		public static function clone(pObject:*):*{
			var byteArray:ByteArray = new ByteArray();
	    	byteArray.writeObject(pObject);
	    	byteArray.position = 0;
	    	return byteArray.readObject();
		}
	}
}
